import sys
from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
from PyQt5.QtCore import pyqtSignal, QObject

class Signal(QObject):
    showmouse = pyqtSignal()

class Demo(QWidget):

    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.setGeometry(350, 350, 600, 400)
        self.setWindowTitle('SignalAndSlot6')
        
        self.signal = Signal()
        self.signal.showmouse.connect(self.showmessage)
        
        self.show()
    
    def showmessage(self):
        QMessageBox.about(self, 'Mouse', 'Mouse Clicked')
    
    def mousePressEvent(self, e):
        self.signal.showmouse.emit()
       

if __name__ == '__main__':
    app = QApplication(sys.argv)
    demo = Demo()
    sys.exit(app.exec_())